<template>
	<view class="bg-fff">
		<JobItem 
			v-for="(item,index) in joblist" 
			:key="item.objectId"
			:jobdata="item"
		/>
	</view>
</template>

<script>
	import {getJobList} from '../../api/job.js'
	let page=0
	export default {
		data() {
			return {
				joblist:[]
			};
		},
		onLoad() {
			getJobList().then(res=>{
				console.log(res);
				this.joblist = res.results
			})
		},
		onReachBottom() {
			console.log('触底了');
			page++
			getJobList({page}).then(({results})=>{
				if(results.length){
					this.joblist = [
						...this.joblist,
						...results
					]
					return
				}
				page--
				uni.showToast({
					title:'我是有底线的~',
					icon:'none'
				})
			})
		}
	}
</script>

<style lang="scss">

</style>
